# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
pkgname=grommunio-index
pkgdesc="Generator for grommunio-web search indexes"
pkgver=1.0
pkgrel=2
arch="all !riscv64"
url="https://grommunio.com"
license="AGPL-3.0-only"
options="!check" # No test suite
makedepends="cmake samurai libexmdbpp-dev libhx-dev sqlite-dev>=3.27 mariadb-connector-c-dev"

source="$pkgname-$pkgver.tar.gz::https://github.com/grommunio/grommunio-index/archive/refs/tags/$pkgver.tar.gz
	0001-makefile.patch

	$pkgname.cron
	"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_SKIP_INSTALL_RPATH=ON

	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	# license
	install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

	# install cronjob
	install -Dm755 "$srcdir"/$pkgname.cron "$pkgdir"/etc/periodic/15min/$pkgname

}

sha512sums="
8e11ff019c124ce8cf54116bff288411942f9da0661a7e88d66cb9d7354b6eb4bf7a1583f353920318b9c75dfccf5b3e88a7f3141da112ba4d676e57533d93e4  grommunio-index-1.0.tar.gz
30a928e94fe5ecc9107cc1e72b5b6a0c7a408f963f79feb816917e11cdf8213f59a88b5cbee0b9c5e2bb580a5c920d048b51a314238ddcf5e9bb29fbcf1c0ad5  0001-makefile.patch
6b594679d6ca937b6b52ece05b3a7dca908d693ab823b866dea5105defcc8ab7462a3aba9101ac6e4eb61b9397d81dd20ecc20598efb5521062e3611bb8b050d  grommunio-index.cron
"
